import time

setGlobalDuration(-1)

beginPythonInst(1)
soundfont(duration=1)
endPythonInst()

proc = startCsound()

notes = '''67 69 71 74 72 72 76 74 74 79 78 79 74 71 67 69 71 72 74 76 74 72 71 69 71 67 66 67 \
	69 62 66 69 72 71 69 71 67 69 71 74 72 72 76 74 74 79 78 79 74 71 67 69 71 64 74 72 \
	71 69 67 62 67 66 67 71 74 79 74 71 67 71 74 79 62 64 66 69 67 69 72 71 72 69 66 62 66 \
	69 72 71 69 71 67 69 71 74 72 72 76 74 74 79 78 79 74 71 67 69 71 64 74 72 71 69 67 62 \
	67 66 67 71 69 71 74 72 72 76 74 74 79 78 79 74 71 67 69 71 72 74 76 74 72 71 69 71 67 \
	66 67 69 62 66 69 72 71 69 71 67 69 71 74 72 72 76 74 74 79 78 79 74 71 67 69 71 64 74 \
	72 71 69 67 62 67 66 67 62 64 66 69 67 69 72 71 72 69 66 62 66 69 72 71 69 71 67 69 71 \
	74 72 72 76 74 74 79 78 79 74 71 67 69 71 64 74 72 71 69 67 62 67 66 67'''
list = [int(n) for n in notes.split()]

time.sleep(1)

mrk = markov(2)
mrk.mkSetList(list)
mrk.mkStartPlayback()

def pit():
    dict = {'soundfont': {}}
    dict['soundfont']['midipitch'] = mrk.next()+12
    sendEvent(1, dict, proc)

pat = pattern(.125, pit, [1])
pat.start()
pat.play()



